.\"
.\" Copyright (c) 2007 Apple Inc.  All rights reserved.
.\"
.\" @APPLE_LICENSE_HEADER_START@
.\" 
.\" This file contains Original Code and/or Modifications of Original Code
.\" as defined in and that are subject to the Apple Public Source License
.\" Version 2.0 (the 'License'). You may not use this file except in
.\" compliance with the License. Please obtain a copy of the License at
.\" http://www.opensource.apple.com/apsl/ and read it before using this
.\" file.
.\" 
.\" The Original Code and all software distributed under the License are
.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
.\" Please see the License for the specific language governing rights and
.\" limitations under the License.
.\" 
.\" @APPLE_LICENSE_HEADER_END@
.\"
.Dd January 9, 2007
.Dt NFSCLNT 2
.Os
.Sh NAME
.Nm nfsclnt
.Nd NFS client services
.Sh SYNOPSIS
.Fd #include <unistd.h>
.Fd #include <nfs/nfs.h>
.Ft int
.Fn nfsclnt "unsigned long request" "void *argstructp"
.Sh DESCRIPTION
The
.Fn nfsclnt
function is used by the NFS client daemons to pass information into and out
of the kernel.
The
.Fa request
argument consists of several bits that show what action is to be taken
once in the kernel and the
.Fa argstructp
points to any corresponding data that the action may require.
.Pp
.Xr rpc.lockd 8
calls
.Fn nfsclnt
with the flag
.Dv NFSCLNT_LOCKDANS
and a pointer to a
.Bd -literal
struct lockd_ans {
	int		la_version;		/* lockd_ans version */
	int		la_errno;		/* return status */
	u_int64_t	la_xid;			/* unique message transaction ID */
	int		la_flags;		/* answer flags */
	pid_t		la_pid;			/* pid of lock requester/owner */
	off_t		la_start;		/* lock starting offset */
	off_t		la_len;			/* lock length */
	int 		la_fh_len;		/* The file handle length. */
	u_int8_t	la_fh[NFSV3_MAX_FH_SIZE];/* The file handle. */
};
.Ed
.sp
to pass the response to an NFS file locking request back
into the kernel.
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.  Otherwise, -1
is returned and the global variable
.Va errno
is set to specify the error.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EPERM
The caller is not the super-user.
.It Bq Er EINVAL
The action specified by the
.Fa flags
argument was not valid.
.It Bq EFAULT
.Fa argstructp
points to an invalid address.
.It Bq EPIPE
The response doesn't match any currently-outstanding lock request.
.It Bq ENOSYS
.Fa nfsclnt
character device was not found.
.El
.Sh SEE ALSO
.Xr rpc.lockd 8
.Sh BUGS
The
.Nm nfsclnt
system call is designed specifically for the
.Tn NFS
client daemons and as such is specific to their requirements.  Several
fields of the argument structures are assumed to be valid, such that
.Nm nfsclnt
must be used with extreme care.
